#include<iostream>
#include<cstdio>
#define sto using
#define Jayun namespace
#define orz std;
sto Jayun orz;

int n,l,r;

int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	int t=l/n*n;
	printf("%d",min(n-1,r-t));
}
